<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('商品取货列表')" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <div class="select-list">
                        <ul>
                            <li>
                                <label>联系人：</label>
                                <input type="text" name="toName"/>
                            </li>
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>

            <div class="btn-group-sm" id="toolbar" role="group">
                <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="lucky:takeover:export">
                    <i class="fa fa-download"></i> 导出
                </a>
            </div>
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
     <div class="modal inmodal" id="myModal" tabindex="-1" role="dialog" aria-hidden="true">
         <div class="modal-dialog">
             <div class="modal-content animated bounceInRight">
                 <div class="modal-header">
                     <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">关闭</span>
                     </button>
                     <i class="fa fa-laptop modal-icon"></i>
                     <h4 class="modal-title">图片凭据</h4>
                 </div>
                 <div class="modal-body">
                    <img  id="photo">
                 </div>
             </div>
         </div>
     </div>
     <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('lucky:takeover:edit')}]];
        var removeFlag = [[${@permission.hasPermi('lucky:takeover:remove')}]];
        var prefix = ctx + "lucky/takeover";

        $(function() {
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                exportUrl: prefix + "/export",
                modalName: "商品取货",
                columns: [{
                    checkbox: true
                },
                {
                    field: 'toPic',
                    title: '图片凭证',
                    visible: false
                },
                {
                    field: 'toId',
                    title: '订单id',
                    visible: false
                },
                {
                    field: 'tBlindbox.blindboxName',
                    title: '开启盲盒'
                },
                {
                    field: 'tGoods.goodsName',
                    title: '开启商品'
                },
                // {
                //     field: 'toWay',
                //     title: '收货方式'
                // },
                {
                    field: 'toName',
                    title: '联系人'
                },
                {
                    field: 'toArea',
                    title: '收货地址'
                },
                {
                    field: 'toPhone',
                    title: '联系手机'
                },
                {
                    field: 'status',
                    title: '状态',
                    formatter: function (value, row, index) {
                        if(value ==0){
                            return  '正常'
                        }else{
                            return  '关闭'
                        }
                    }
                },
                {
                    field: 'remark',
                    title: '备注'
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        actions.push(' <button type="button" class="btn btn-primary"  onclick="showPic(\'' + row.toPic + '\')"">图片凭据</button>');
                        return actions.join('');
                    }
                }]
            };
            $.table.init(options);
        });

       function showPic(toPic){
           $("#photo").attr("src",toPic);
            $("#myModal").modal({
                keyboard:false
            });
        }

    </script>
</body>
</html>